import request from '@/config/axios'

// 套餐功能对应 VO
export interface FunctionVO {
  id: number // ID
  packageId: number // 套餐ID
  packageName: string
  functionId: number // 功能ID
  functionName: string
  choosed: boolean // 选择状态
  canChoose: boolean // 是否可选
  remark: string // 备注
}

// 套餐功能对应 API
export const FunctionApi = {
  // 查询套餐功能对应分页
  getFunctionPage: async (params: any) => {
    return await request.get({ url: `/package/package-function/page`, params })
  },

  // 查询套餐功能对应详情
  getFunction: async (id: number) => {
    return await request.get({ url: `/package/package-function/get?id=` + id })
  },

  // 新增套餐功能对应
  createFunction: async (data: FunctionVO) => {
    return await request.post({ url: `/package/package-function/create`, data })
  },

  // 修改套餐功能对应
  updateFunction: async (data: FunctionVO) => {
    return await request.put({ url: `/package/package-function/update`, data })
  },

  // 删除套餐功能对应
  deleteFunction: async (id: number) => {
    return await request.delete({ url: `/package/package-function/delete?id=` + id })
  },

  // 导出套餐功能对应 Excel
  exportFunction: async (params) => {
    return await request.download({ url: `/package/package-function/export-excel`, params })
  }
}